/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package samoloty.view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.FocusListener;

/**
 *
 * @author borysfan
 */
public class FuelPanel extends ContentPanel implements IContentPanel {

    public int identity = 2;
    private FuelSubPanel fuelSubPanel;
    //private InfoSubPanel infoSubPanel;
    private PlotPanel plotPanel;

    public FuelPanel() {
        super();
        initPanel();
    }

    private void initPanel() {
        fuelSubPanel = new FuelSubPanel();
        fuelSubPanel.setPreferredSize(new Dimension(fuelSubPanel.getPreferredSize().width, fuelSubPanel.getPreferredSize().height - 300));
        fuelSubPanel.setBounds(0, 0, getWidth(), 250);
        setLayout(null);
        add(fuelSubPanel);

    }

    public void addInfoSubPanel(InfoSubPanel infoPanel) {
        infoPanel.setPreferredSize(new Dimension(289, 289));
        infoPanel.setBounds(getWidth() - 289, fuelSubPanel.getHeight() - 1, 289, getHeight() - fuelSubPanel.getHeight() + 1);
        add(infoPanel);
    }

    public String getTakeFuelOffText() {
        return fuelSubPanel.getTakeOffText();
    }

    public String getTripFuelText() {
        return fuelSubPanel.getTripFuelText();
    }

    public String getTaxiFuelText() {
        return fuelSubPanel.getTaxiFuelText();
    }

    public String getMaxFuelText() {
        return fuelSubPanel.getMaxFuelLabValue();
    }

    public void setMaxFuelText(String value) {
        fuelSubPanel.setMaxFuelLabValue(value);
    }

    public String getTotalFuelText() {
        return fuelSubPanel.getTotalFuelLabValue();
    }

    public void setTotalFuelText(String value) {
        fuelSubPanel.setTotalFuelLabValue(value);
    }

    public void setTakeOffFocusListener(FocusListener listener) {
        fuelSubPanel.setTakeOffFocusListener(listener);
    }

    public void setTaxiFocusListener(FocusListener listener) {
        fuelSubPanel.setTaxiFuelFocusListener(listener);
    }

    public void setTripFocusListener(FocusListener listener) {
        fuelSubPanel.setTripFuelFocusListener(listener);
    }

    public void reset() {
        fuelSubPanel.reset();
    }

    public void setPlotPanel(PlotPanel instance) {
        plotPanel = instance;
        plotPanel.setBounds(1, fuelSubPanel.getHeight() - 1, 288, getHeight() - fuelSubPanel.getHeight());
        add(plotPanel);
    }

    public String get_vtof() {
        return fuelSubPanel.get_vtof();
    }

    public String get_vtf() {
        return fuelSubPanel.get_vtf();
    }

    public String get_vtxf() {
        return fuelSubPanel.get_vtxf();
    }

    public void setVtofControlText(String s) {
        fuelSubPanel.setVtofControlerText(s);
    }

    public void setVtofControlTextVisible(boolean b) {
        System.err.println("Zmiana widoczności na " + b);
        fuelSubPanel.setVtofControlerTextVisible(b);
    }

    public void setTaxiFuelControlerLab(String s) {
        fuelSubPanel.setTaxiFuelControlLab(s);
    }

    public void setTaxiFuelControlVisible(boolean b) {
        fuelSubPanel.setTaxiFuelControlLabVisible(b);
    }

    public void setTripFuelControlerLab(String s) {
        fuelSubPanel.setTripFuelControlText(s);
    }

    public void setTripFuelControlVisible(boolean b) {
        fuelSubPanel.setTripFuelControlVisible(b);
    }

    public void setTofBorder(Color c) {
        fuelSubPanel.setTofBorder(c);
    }

    public void setTfBorder(Color c) {
        fuelSubPanel.setTfBorder(c);
    }

    public void setTaxiFuelBorder(Color c) {
        fuelSubPanel.setTaxiFuelBorder(c);
    }

    public void firstFocused() {
        fuelSubPanel.firstFocused();
    }

    public void removeActionListeners() {
        fuelSubPanel.removeActionsListeners();
    }

    @Override
    public int getIdentity() {
        return identity;
    }

    @Override
    public boolean isValid() {
        try {
            return fuelSubPanel.isValid();

        } catch (NullPointerException e) {
        }
        return true;
    }
}
